package org.thingsboard.server.dao.sql.schedulerEvent;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.thingsboard.server.common.data.SchedulerEvent;
import org.thingsboard.server.dao.model.sql.SchedulerEventEntity;

import java.util.List;
import java.util.UUID;

public interface SchedulerEventRepository  extends CrudRepository<SchedulerEventEntity, UUID>{
    Long countByTenantId(UUID tenantId) ;

    @Query("SELECT DISTINCT d.type FROM SchedulerEventEntity d WHERE d.tenantId = :tenantId")
    List<String> findSchedulerEventTypes(@Param("tenantId")UUID tenantId);

    @Query("SELECT d FROM SchedulerEventEntity d WHERE d.id = :id")
    SchedulerEvent findBySchedulerEventId(@Param("id")UUID id);
}
